drwhite Posted December 11, 2009 Share Posted December 11, 2009 I quote the help file in AutoCAD: "Custom images can be created in two different sizes: small and large. Small images should be 16 x 16 pixels. Large images should be 32 x 32 pixels. Images that do not match these sizes are scaled to fit. " Now how exactly does one create a 32x32 pixel icon button. All I can do is 16x16. I click "large only" and "both" and nothing seems to work. What is the method? Is there another editor? I created a .bmp in 32x32 outside of Autocad and imported it. It came in 16x16. Why? Why does the internal .bmps in AutoCAD look so good and I can't create one like that? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 11, 2009 Share Posted December 11, 2009 This seems to work (defun Put_BitMap (tbutt sml lrg / tbutt) (vl-load-com) (setq tbutt (strcase tbutt)) (vlax-for Men (vla-get-MenuGroups (vlax-get-acad-object)) [color=Red][b];; Cycle through MenuGroups[/b][/color] (vlax-for Tool (vla-get-Toolbars Men) [color=Red][b];; Cycle through Toolbars[/b][/color] (vlax-for Butt Tool [b][color=Red];; Cycle through Buttons[/color][/b] (if (eq tbutt (strcase (vla-get-Name Butt))) [b][color=Red];; If button name matches[/color] [/b] (vla-SetBitmaps Butt sml lrg)))))) [b][color=Red];; Set the BitMaps[/color][/b] (defun c:test () (put_bitMap "Command1" [b][color=Red];; Button Name[/color][/b] "C:\\Users\\Lee Mac\\Pictures\\Untitled.bmp" [b][color=Red];; Small Bitmap filepath[/color][/b] "C:\\Users\\Lee Mac\\Pictures\\Untitled2.bmp") [b][color=Red];; Large Bitmap filepath[/color][/b] (princ)) Quote Link to comment Share on other sites More sharing options...
drwhite Posted December 11, 2009 Author Share Posted December 11, 2009 Mr. Mac, or Lee: I loaded the routine. Entered: test A lot of stuff scrolled down the screen at near light speed. I don't know what happened, but something did. Add a few of the old ;this does this and ;this does that to each line in your routine. I don't exactly comprehend how this converts or allows me to create a 32x32 .bmp file for my buttons on my custom commands. Details and explanations will really help. Thank you sir. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 11, 2009 Share Posted December 11, 2009 Sorry DrWhite - I left a print statment in there by accident... code updated You will need to provide the sub (Put_BitMap) with the name of the button (eg "Command1"), and the filepath of the small and large bitmaps, and it should assign them to the button (if the button is found). Lee Quote Link to comment Share on other sites More sharing options...
drwhite Posted December 11, 2009 Author Share Posted December 11, 2009 So I have to put every button (or .bmp file) name in the routine (with correct path) and this routine will convert them to large buttons? How is it that when I open an Autocad bmp that it only shows in small size no matter what I select on "Large" or "Small"? If I change my option button to large icons will this have an effect? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 11, 2009 Share Posted December 11, 2009 Hi DrWhite, For multiple bitmaps, perhaps this: (defun Put_BitMap (lst / lst tag) (vl-load-com) (setq lst (mapcar (function (lambda (x) (list (strcase (car x)) (cadr x) (caddr x)))) lst)) (vlax-for Men (vla-get-MenuGroups (vlax-get-acad-object)) (vlax-for Tool (vla-get-Toolbars Men) (vlax-for Butt Tool (if (setq tag (assoc (strcase (vla-get-Name Butt)) lst)) (vla-SetBitmaps Butt (cadr tag) (caddr tag))))))) (defun c:test nil (put_bitMap '(("Command1" "C:\\Small.bmp" "C:\\Large.bmp") ("Command2" "C:\\Small.bmp" "C:\\Large.bmp") ("Command3" "C:\\Small.bmp" "C:\\Large.bmp") ("Command4" "C:\\Small.bmp" "C:\\Large.bmp") ("Command5" "C:\\Small.bmp" "C:\\Large.bmp") ("Command6" "C:\\Small.bmp" "C:\\Large.bmp"))) (princ)) The large bitmap should show if you put "Use Large Buttons for Toolbars" in the Options dialog. Quote Link to comment Share on other sites More sharing options...
drwhite Posted December 11, 2009 Author Share Posted December 11, 2009 For toolbars that is understandable. For custom commands with a button .bmp assigned to it, no. I guess I am just failing to grasp the syntax of your routine, but how does (command c:\\small.bmp c:\\large.bmp) (left out all the quotes) work? Is it renaming .bmp files? Does this just work for toolbars? I don't want it for toolbars. I want it for Button Edit. Look at the button icons in the CUI for AutoCAD customization. See how the buttons have all the shading and fine detail? Thats only possible with 32x32 pixel .bmps. All that comes up in AutoCAD is a 16x16 grid box. How do I get that to be a 32x32 grid box? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 11, 2009 Share Posted December 11, 2009 For toolbars that is understandable. For custom commands with a button .bmp assigned to it, no. I guess I am just failing to grasp the syntax of your routine, but how does (command c:\\small.bmp c:\\large.bmp) (left out all the quotes) work? Is it renaming .bmp files? Does this just work for toolbars? I don't want it for toolbars. I want it for Button Edit. Look at the button icons in the CUI for AutoCAD customization. See how the buttons have all the shading and fine detail? Thats only possible with 32x32 pixel .bmps. All that comes up in AutoCAD is a 16x16 grid box. How do I get that to be a 32x32 grid box? The program looks for the button with the name "Command1" and puts the small bitmap as the first filename, and the large bitmap as the second filename. I am not sure how to get the edit box for the large bitmap, but this works for me to set the large and small bitmaps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.